#include "mainwindow.h"
#include "rpi_sensors.h"
#include <QDebug>

gpsWidget::gpsWidget(QObject *parent,rpi_sensor_gps *a) {
    setupUi(this);
    gps =a;
    refreshContent();
    connect(centreOnMapBtn,SIGNAL(clicked()),this,SLOT(centreOnMapClicked()));
}

gpsWidget::~gpsWidget() {

}


void gpsWidget::refreshContent() {


    currentLatitude->setText( QString("%1").arg(gps->getLatitude()));
    currentLongitude->setText( QString("%1").arg(gps->getLongitude()));
    currentHeight->setText( QString("%1").arg(gps->getHeight()));
    qDebug() << "updateGPS";
    if (!gps) return;

}

void gpsWidget::updateGPS(rpi_sensor_gps* g){




}
void gpsWidget::centreOnMapClicked() {

    emit centreOnMap(gps->getLatitude(),gps->getLongitude());
}
